//
//  WJChatViewController.m
//  PYWGetColor
//
//  Created by 杜文杰 on 2018/7/5.
//  Copyright © 2018年 dwj. All rights reserved.
//

#import "WJChatViewController.h"

@interface WJChatViewController ()<EaseMessageViewControllerDelegate,EaseMessageViewControllerDataSource>
@property (weak, nonatomic) id<EaseMessageViewControllerDelegate>delegate;
@property (weak, nonatomic) id<EaseMessageViewControllerDataSource>dataSource;
@end

@implementation WJChatViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.delegate = self;
    self.dataSource = self;
    
    self.showRefreshFooter = YES;
    [self.chatBarMoreView removeItematIndex:1];
    [self.chatBarMoreView removeItematIndex:2];
    [self.chatBarMoreView removeItematIndex:2];
}


#pragma mark - EaseMessageViewControllerDataSource
- (id<IMessageModel>)messageViewController:(EaseMessageViewController *)viewController modelForMessage:(EMMessage *)message
{
    id<IMessageModel> model = nil;
    model = [[EaseMessageModel alloc] initWithMessage:message];
    
    if (model.isSender) {//自己发送
        
        model.message.ext = @{@"avatar":[UserModel sharedInstanced].headImg,@"nickname":[UserModel sharedInstanced].nameNick};
        //头像
        model.avatarURLPath = [UserModel sharedInstanced].headImg;
        //昵称
        model.nickname = [UserModel sharedInstanced].nameNick;
        //头像占位图
        model.avatarImage = [UIImage imageNamed:@"我的(1)"];
        
    }else{//对方发送
        //头像占位图
        model.avatarImage = [UIImage imageNamed:@"我的(1)"];
        //头像
        model.avatarURLPath = message.ext[@"avatar"];
        //昵称
        model.nickname =  message.ext[@"nickname"];
        
    }
    
    
    return model;
}

@end
